package com.jeecms.wicool.manager.car.impl;

import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jeecms.common.hibernate3.Updater;
import com.jeecms.common.page.Pagination;
import com.jeecms.wicool.dao.car.CarParamDao;
import com.jeecms.wicool.dao.product.ProductSkuDao;
import com.jeecms.wicool.entity.car.CarParam;
import com.jeecms.wicool.entity.car.CarType;
import com.jeecms.wicool.entity.product.Product;
import com.jeecms.wicool.entity.product.ProductSku;
import com.jeecms.wicool.manager.car.CarParamMng;
import com.jeecms.wicool.manager.car.CarTypeMng;
import com.jeecms.wicool.manager.product.ProductMng;
import com.jeecms.wicool.manager.product.ProductSkuMng;

@Service
@Transactional
public class CarParamMngImpl implements CarParamMng {
	
	private CarParamDao dao;
	@Autowired
	public void setDao(CarParamDao dao) {
		this.dao = dao;
	}
	
	@Transactional(readOnly = true)
	public Pagination getPage(Integer carTypeId,int pageNo, int pageSize) {
		Pagination page = dao.getPage(carTypeId,pageNo, pageSize);
		return page;
	}
	@Override
	public CarParam findById(Integer id) {
		CarParam entity = dao.findById(id);
		return entity;
	}

	@Override
	public CarParam update(CarParam bean) {
		Updater<CarParam> updater = new Updater<CarParam>(bean);
		bean = dao.updateByUpdater(updater);
		return bean;
	}
	
	@Override
	public CarParam save(CarParam bean) {
		dao.save(bean);
		return bean;
	}

	@Override
	public CarParam deleteById(Integer id) {
		CarParam bean = dao.deleteById(id);
		return bean;
	}
	@Override
	public CarParam[] deleteByIds(Integer[] ids) {
		CarParam[] beans = new CarParam[ids.length];
		for (int i = 0,len = ids.length; i < len; i++) {
			beans[i] = deleteById(ids[i]);
		}
		return beans;
	}
	@Autowired
	private CarTypeMng carTypeMng;

}